<?php
/* @var $this PageController */
/* @var $model Page */

$this->breadcrumbs=array(
      $model->title,
);

$this->pageTitle = $model->title;

?>

<h3>
    <?php echo $model->title; ?>
</h3>

<?php if(!empty($model->description)) : ?>
<p class="description">
    <?php echo $model->description; ?>
</p>
<?php endif; ?>

<p>
    <?php echo $model->content; ?>
</p>

<?php
if (!empty($model->galleryBehavior->getGallery()->galleryPhotos)) {

   Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/scripts/jquery.mousewheel-3.0.6.pack.js');
   Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/scripts/jquery.fancybox.pack.js');

   Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . '/css/jquery.fancybox.css');

   echo '<ul class="thumbnails" >';

   foreach ($model->galleryBehavior->getGallery()->galleryPhotos as $photo){
      echo '<li class="span4" >';

      echo CHtml::link(
         CHtml::image($photo->getUrl('small')),
         $photo->url,
         array('class'=>'thumbnail fancybox', 'data-fancybox-group'=> 'gallery', 'title'=> $photo->description));
   }

   echo '<ul/>';

}
?>

<script type="text/javascript">

jQuery(document).ready(function() {

   jQuery("a.fancybox").fancybox();

});
</script>
